﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;

namespace HelloWord {
    internal class HelloWord {
        static void Main(string[] args) {
            Console.WriteLine("HelloWord");
            //Console.ReadKey();

            //变量的类型 变量名称 = 初始值;

            //cpu 100 200 
            //cpu只管执行指令 不管数据存储
            //内存

            //=:赋值 这里能用var是因为这是c#的一个语法糖，会自动推算类型
            //var n = 100;
            //var m = 200;
            //var sum = 0;
            //sum = n + m;
            //string str = "你的计算结果是："+sum;
            //.net 提供了很多输出方法，这里不用加System是因为上面引入了System
            //Console.WriteLine(str);

            //赋值
            //int x = 0;
            //int y = 200;
            //int sumxy = x +y;

            //int n1 = 20;
            //int n2 = 30;
            //int temp = 0;
            //temp = n1;
            //n1 = n2;
            //n2 = temp;
            //Console.WriteLine("n2的值为："+n2);

            //Console.WriteLine("请输入一个数字");
            //String redStr = Console.ReadLine();
            ////string转换为int
            //int redInt = int.Parse(redStr)+20;
            //Console.WriteLine(redInt);

            //Console.ReadKey();

            // bool flag = true;
            //int i = 1;
            //if (i != 1) {
            //    flag = true;
            //} else { 
            //    flag = false;
            //}
            //Console.WriteLine(flag);

            GetUserInfo();

            //循环
            for (int i = 0; i < 2; i++) {
                Console.WriteLine("i的值为："+i);
            }
            int x = 2;
            while (x < 3) {
                ++x;
                Console.WriteLine("x的值为："+x);
            }
            //foreach 
            int[] fibarray = new int[] { 0, 1, 1, 2, 3, 5, 8, 13 };
            foreach (int element in fibarray) {
                Console.WriteLine("foreach：" + element);
            }
            //dowhile
            int dowhile = 0;
            do{
                Console.WriteLine("doWhile");
            }while (dowhile > 0);

        }

        public static void GetUserInfo() { 
            Console.WriteLine("方法测试");
        }

    }


}
